<template>
	<view class="box">
		<u-toast ref="uToast"></u-toast>
		<view class="box-content">
			<textarea maxlength="14000" placeholder="请输入驳回意见……" v-model="bhyy" height="800!important" style="background-color:#f6f6f6;height: 80vh!important;width: 100%;border-radius: 10px;padding: 20rpx 24rpx;box-sizing: border-box;" name="" id=""
				cols="100" rows="10"></textarea>
		</view>
		<view class="btns">
				<u-button type="primary" @click="submit" text="确定"></u-button>
		</view>
	</view>
</template>

<script>
	import { approve } from '../../../api/space.js'
	export default {
		data() {
			return {
				obj:null,
				id:null,
				bhyy:''
			}
		},
		onLoad(obj) {
			this.obj = JSON.parse(obj.details)
			this.id = this.obj.id
			// console.log(this.obj);
			// console.log(this.id);
		},
		methods: {
			submit(){
				const data = {
					checkResult:2,
					zyp:this.id,
					qmtp:this.bhyy
				}
				if (this.bhyy != '') {
					approve(data).then((res) =>{
						// console.log(res);
						if(res.code == 200){
							this.$refs.uToast.show({
								type: 'success',
								message: "驳回成功",
								iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/jump.png'
							})
							window.setTimeout(function () {
							    uni.reLaunch({
							    	url:'/pages/home/home'
							    })
							}, 1000);	
						}
					})
				}else{
					uni.showToast({
					  icon: 'error',
					  duration: 2000,
					  position:'top',
					  title: `请先提写驳回意见`
					});
				}
				
			}
		}
	}
</script>

<style lang="scss">
.box{
	width: 100vw;
	// height: calc(100% - 80rpx);
	padding: 40rpx 24rpx;
	box-sizing: border-box;
	.box-content{
		width: 100%;
		height: 80vh;
		border-radius: 16rpx;
		background-color: #f5f5f5;
	}
	.btns{
		width: 100%;
		margin: 40rpx 0 20rpx;
		height: 80rpx;
	}
}
.uni-textarea-compute{
	height: 80vh!important;
}
		
.textarea-placeholder{
	height: 80vh!important;
}
</style>
